<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/5/27 0027
 * Time: 9:55
 */

namespace app\admin\controller;


use think\Session;

class Middle extends Base
{
    public $aid;
    public function __construct()
    {
        parent::__construct();
        $auth = Session::get('auth');
        if(!$auth)exit($this->encode('请登录'));
        if(time() > $auth['expire'])exit($this->encode('登录超时,请重新登录'));
        $this->aid= $auth['aid'];
        $set = ['aid'=>$auth['aid'],'expire'=>time()+3600,'account'=>$auth['account']];
        Session::set('auth',$set);
    }
}